home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / blitzbasic / blitz-list200994.lha / blitz-list / 000240_blitz-list-request_Tue Aug 23 12:43:41 1994.msg < prev    next >
Internet Message Format  |  1994-09-20  |  2KB

  1. Received: from email (email.meto.govt.uk [151.170.240.2]) by kantti.helsinki.fi (8.6.9/8.6.5) with ESMTP id MAA27351 for <blitz-list@helsinki.fi>; Tue, 23 Aug 1994 12:43:23 +0300
  2. From: hadmo%HADL60@email.meto.govt.uk
  3. Received: from email.meto.govt.uk (HADMO@HADL60) by email.meto.govt.uk (PMDF
  4.  V4.2-11 #3313) id <01HG8SUOIGEO001GNZ@email.meto.govt.uk>; Tue,
  5.  23 Aug 1994 09:40:21 GMT
  6. Date: Tue, 23 Aug 1994 09:40:21 +0000 (GMT)
  7. Subject: RGB --> HSV
  8. To: blitz-list@helsinki.fi
  9. Message-id: <01HG8SUOJIZM001GNZ@email.meto.govt.uk>
  10. X-VMS-To: EMAIL::in%"blitz-list@helsinki.fi"
  11. MIME-version: 1.0
  12. Content-type: TEXT/PLAIN; CHARSET=US-ASCII
  13. Content-transfer-encoding: 7BIT
  14. X-Status: 
  15. Status: O
  16.  
  17.  
  18.   Someone asked about the relationship between RGB and HSV...
  19.  
  20.   The following algorithm converts from RGB (normalised from 0 to 1) to
  21.   HSV (taken from "Interactive computer graphics" - Burger and Gillies):
  22.  
  23.  
  24.  
  25.   maxcol=MAX(red,green,blue)
  26.   mincol=MIN(red,green,blue)
  27.   value=maxcol
  28.   IF (maxcol=mincol)
  29.     saturation=0
  30.     ; Hue is undefined, colour is white, grey or black
  31.   ELSE
  32.     saturation=(MaximumComponent-MinimumComponent)/MaximumComponent   ***
  33.     IF (mincol=blue)
  34.       hue=120*(green-mincol)/(red+green-2*mincol)
  35.     ELSE IF (mincol=red)
  36.       hue=120*(1+(blue-mincol)/(blue+green-2*mincol))
  37.     ELSE
  38.       hue=120*(2+(red-mincol)/(red+blue-2*mincol))
  39.     ENDIF
  40.   ENDIF
  41.  
  42. *** I'm not sure what it means by Maximum and MinimumComponent, maybe it
  43.     just means maxcol and mincol?
  44.  
  45.  
  46.  -Matthew.
  47.  
  48.  ____________________________________________________________________________
  49. ////////// Matthew O'Donnell |||||||||| modonnell@email.meto.govt.uk \\\\\\\\\
  50. ------------------------------------------------------------------------------